home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / program / ixemlsrc.lha / ixemul / library / ix_panic.c < prev    next >
C/C++ Source or Header  |  1995-12-23  |  3KB  |  89 lines

  1. /*
  2.  *  This file is part of ixemul.library for the Amiga.
  3.  *  Copyright (C) 1991, 1992  Markus M. Wild
  4.  *
  5.  *  This library is free software; you can redistribute it and/or
  6.  *  modify it under the terms of the GNU Library General Public
  7.  *  License as published by the Free Software Foundation; either
  8.  *  version 2 of the License, or (at your option) any later version.
  9.  *
  10.  *  This library is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  *  Library General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU Library General Public
  16.  *  License along with this library; if not, write to the Free
  17.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  *  ix_panic.c,v 1.1.1.1 1994/04/04 04:30:39 amiga Exp
  20.  *
  21.  *  ix_panic.c,v
  22.  * Revision 1.1.1.1  1994/04/04  04:30:39  amiga
  23.  * Initial CVS check in.
  24.  *
  25.  *  Revision 1.2  1992/08/09  20:53:58  amiga
  26.  *  add cast
  27.  *
  28.  *  Revision 1.1  1992/05/14  19:55:40  mwild
  29.  *  Initial revision
  30.  *
  31.  */
  32.  
  33. /*
  34.  * This once was req.c by Markus Wandel. It doesn't look too much like the
  35.  * original version though... Well, it was PD, I used it, so here is his
  36.  * original disclaimer:
  37.  *
  38.  * req.c - by Markus Wandel - 1990
  39.  * Placed in the public domain 7 Oct 1990
  40.  * Please have the courtesy to give credit if you use this code
  41.  * in any program.
  42.  *
  43.  */
  44. #define KERNEL
  45. #include <ixemul.h>
  46. #include <stdarg.h>
  47.  
  48. #include <proto/intuition.h>
  49.  
  50. void ix_panic (const char *msg, ...)
  51. {
  52.   struct IntuitionBase *IntuitionBase;
  53.   va_list ap;
  54.   u_char old_flags;
  55.   struct Task *me = (*(struct ExecBase **)4)->ThisTask;
  56.  
  57.   /*
  58.    * This function may be called with our signals enabled. So we have to make
  59.    * sure that no signals are processed while in here.
  60.    * Since this function may be called at random points in initialization,
  61.    * it is not safe to call sigsetmask() here, so I have to resort to the
  62.    * more drastic solution of temporarily turning off TF_LAUNCH
  63.    */
  64.   old_flags = me->tc_Flags;
  65.   me->tc_Flags &= ~TF_LAUNCH;
  66.  
  67.   /* we (re)open intuition, because that way we don't depend on arp.library
  68.    * being available for us to open intuibase */
  69.  
  70.   if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0)))
  71.     {
  72.       struct EasyStruct panic = {
  73.         sizeof(struct EasyStruct),
  74.         0,
  75.         "",
  76.         (char *)msg,
  77.         "Abort"
  78.       };
  79.         
  80.       va_start(ap, msg);
  81.       EasyRequestArgs(NULL, &panic, NULL, ap);
  82.       va_end(ap);
  83.  
  84.       CloseLibrary ((struct Library *) IntuitionBase);
  85.    }
  86.  
  87.   me->tc_Flags = old_flags;
  88. }
  89.